package com.binhthuan.catechist.client.viewer;

import com.binhthuan.catechist.client.ECApplication;
import com.binhthuan.catechist.client.component.DetailFormatter;
import com.binhthuan.catechist.client.data.ScheduleDS;
import com.binhthuan.catechist.shared.constant.Parameter;
import com.smartgwt.client.widgets.viewer.DetailViewerField;

public class ScheduleViewer extends AbstractViewer {

    public ScheduleViewer(ScheduleDS dataSource) {
        super(dataSource);

        DetailViewerField header = new DetailViewerField();
        header.setType(HEADER);
        header.setValue(ECApplication.getConstants().scheduleInformation());

        DetailViewerField dateField = new DetailViewerField(Parameter.DATE_OF_YEAR);
        dateField.setTitle(ECApplication.getConstants().date());
        
        DetailViewerField liturgicalDateField = new DetailViewerField(Parameter.LITURGICAL_DATE);
        liturgicalDateField.setTitle(ECApplication.getConstants().liturgicalDate());

        DetailViewerField titleField = new DetailViewerField(Parameter.TITLE);
        titleField.setTitle(ECApplication.getConstants().title());

        DetailViewerField contentField = new DetailViewerField(Parameter.CONTENT);
        contentField.setTitle(ECApplication.getConstants().content());
        contentField.setDetailFormatter(new DetailFormatter());

        DetailViewerField commentField = new DetailViewerField(Parameter.COMMENT);
        commentField.setTitle(ECApplication.getConstants().comment());
        commentField.setDetailFormatter(new DetailFormatter());

        DetailViewerField statusField = new DetailViewerField(Parameter.STATUS_NAME);
        statusField.setTitle(ECApplication.getConstants().status());

        setFields(header, dateField, liturgicalDateField, titleField, contentField, commentField, statusField);
    }
}
